package com.ncloud.resman.service.impl;

import com.alibaba.fastjson.JSONObject;
import com.ncloud.resman.entity.DeviceCpe;
import com.ncloud.resman.entity.ExportDeviceCPE;
import com.ncloud.resman.mapper.DeviceCpeMapper;
import com.ncloud.resman.service.DeviceCpeService;
import com.ncloud.resman.service.SequenceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

/**
 * Created by shiqiang on 2017/8/15.
 */
@Service
public class DeviceCpeServiceImpl implements DeviceCpeService{
    @Autowired
    private DeviceCpeMapper deviceCpeMapper;
    @Autowired
    private SequenceService sequenceService;

    @Override
    public DeviceCpe getDeviceCpeByDeviceId(Long deviceId) {
        return deviceCpeMapper.getDeviceCpeByDeviceId(deviceId);
    }

    @Override
    public int insertDeviceCpe(DeviceCpe deviceCpe) {
        deviceCpe.setCreateDate(new Date());
        return deviceCpeMapper.insertDeviceCpe(deviceCpe);
    }

    @Override
    public int updateDeviceCpe(DeviceCpe deviceCpe) {
        deviceCpe.setUpdateDate(new Date());
        return deviceCpeMapper.updateDeviceCpe(deviceCpe);
    }

    @Override
    public List<JSONObject> getDeviceCpeList(String state) {
        return deviceCpeMapper.getDeviceCpeList(state);
    }

    @Override
    public int deleteDeviceCpe(Long deviceId) {
        return deviceCpeMapper.deleteDeviceCpe(deviceId);
    }
    
    @Override
	public List<ExportDeviceCPE> exportCPEInfo(String snNum) {
		return deviceCpeMapper.exportCPEInfo(snNum);		
	}
}
